#include "辅助类.h"
#include "图片调用.h"
#include "物资ID.h"

extern 绘制 绘制;

std::map<int, TextureInfo> 手持图片;

static int getLength(const char* str) {
    int len = 0;
    while (*str) {
        if ((*str & 0xC0) != 0x80) {
            len++;
        }
        ++str;
    }
    return len;
}

void 绘图::初始化绘图(int X,int Y){
	if(Y<X){
		this->PX = X/2;
		this->PY = Y/2;
	}else{
		this->PX = Y/2;
		this->PY = X/2;
	}
}

void AddTextBold(ImDrawList *Draw,float size,int x, int y, ImVec4 color,ImVec4 color1, const char* str)
{
    ImGui::GetBackgroundDrawList()->AddText(NULL, size,ImVec2(x + 1, y), ImGui::ColorConvertFloat4ToU32(color1), str);
    ImGui::GetBackgroundDrawList()->AddText(NULL, size,ImVec2(x - 0.1, y), ImGui::ColorConvertFloat4ToU32(color1), str);
    ImGui::GetBackgroundDrawList()->AddText(NULL, size,ImVec2(x, y + 1), ImGui::ColorConvertFloat4ToU32(color1), str);
    ImGui::GetBackgroundDrawList()->AddText(NULL, size,ImVec2(x, y - 1), ImGui::ColorConvertFloat4ToU32(color1), str);
    ImGui::GetBackgroundDrawList()->AddText(NULL, size,ImVec2(x, y), ImGui::ColorConvertFloat4ToU32(color), str);
}
/*
void 绘图::绘制瞄准信息() {
 /* for (int i = 0; i < 绘制.被瞄准对象数量; i++) {
    string 距离显示 = to_string(static_cast<int>(绘制.被瞄信息[i].距离)) + "M";
    ImVec2 textSizeName = ImGui::CalcTextSize(绘制.被瞄信息[i].名字.c_str(), 0, 60);
    ImVec2 textSizeemploy = ImGui::CalcTextSize("使用", 0, 60);
    ImVec2 textSizeWeapon = ImGui::CalcTextSize(绘制.被瞄信息[i].瞄准武器.c_str(), 0, 60);
    ImVec2 textSizeAim = ImGui::CalcTextSize("瞄准您", 0, 60);
    ImVec2 textSizeDistance = ImGui::CalcTextSize(距离显示.c_str(), 0, 60);
    float startY = 200 + (50 * i);
    float spacing = 65.0f; // 调整间距的数值
    textSizeName.x += 12 * static_cast<float>(getLength(绘制.被瞄信息[i].名字.c_str()));
    textSizeWeapon.x += 9.375 * static_cast<float>(getLength(绘制.被瞄信息[i].瞄准武器.c_str()));
    //枪械 9.375 名称 6.25
    float totalWidth = textSizeName.x + textSizeemploy.x + textSizeWeapon.x + textSizeAim.x + textSizeDistance.x + 4 * spacing;
    float startX = PX - totalWidth / 2;
    ImGui::GetBackgroundDrawList()->AddText(NULL, 60, ImVec2(startX, startY), ImColor(0, 0, 255), 绘制.被瞄信息[i].名字.c_str());
    ImGui::GetBackgroundDrawList()->AddText(NULL, 60, ImVec2(startX + textSizeName.x + 1 * spacing, startY), ImColor(255, 255, 255), "使用");
    ImGui::GetBackgroundDrawList()->AddText(NULL, 60, ImVec2(startX + textSizeName.x + textSizeemploy.x + 2 * spacing, startY), ImColor(255, 0, 0), 绘制.被瞄信息[i].瞄准武器.c_str());
    ImGui::GetBackgroundDrawList()->AddText(NULL, 60, ImVec2(startX + textSizeName.x + textSizeemploy.x + textSizeWeapon.x + 3 * spacing, startY), ImColor(255, 255, 255), "瞄准您");
    ImGui::GetBackgroundDrawList()->AddText(NULL, 60, ImVec2(startX + textSizeName.x + textSizeemploy.x + textSizeWeapon.x + textSizeAim.x + 4 * spacing, startY), ImColor(255, 255, 0), 距离显示.c_str());
  }
 */
//}

void 绘图::RenderRadarScan(ImDrawList* draw_list, ImVec2 center, float radius, int numSegments, float& rotationAngle, float lineLength) {
    // 定义颜色
    ImColor backgroundColor = ImColor(30, 30, 30, 100); // 深灰色，半透明
    ImColor mainLineColor = ImColor(200, 200, 200, 255); // 亮灰色
    ImColor scanLineColor = ImColor(0, 255, 0, 255); // 亮绿色
    ImColor shadowColor = ImColor(220, 212, 202, 255); // 浅灰色

    // 绘制背景圆形
    draw_list->AddCircleFilled(center, radius, backgroundColor, numSegments);

    // 绘制主要圆形
    draw_list->AddCircle(center, radius * 0.75f, mainLineColor, numSegments, 2.0f);
    draw_list->AddCircle(center, radius * 0.5f, mainLineColor, numSegments, 2.0f);
    draw_list->AddCircle(center, radius, mainLineColor, numSegments, 2.0f);

    // 绘制十字线
    draw_list->AddLine(
        ImVec2(center.x - lineLength, center.y),
        ImVec2(center.x + lineLength, center.y),
        mainLineColor,
        2.0f
    );
    draw_list->AddLine(
        ImVec2(center.x, center.y - lineLength),
        ImVec2(center.x, center.y + lineLength),
        mainLineColor,
        2.0f
    );

    // 绘制对角线
    float lineAngle1 = 0.25f * 3.141592653589793238;
    float lineAngle2 = -0.25f * 3.141592653589793238;
    ImVec2 line1Start(center.x + lineLength * cos(lineAngle1), center.y + lineLength * sin(lineAngle1));
    ImVec2 line1End(center.x - lineLength * cos(lineAngle1), center.y - lineLength * sin(lineAngle1));
    ImVec2 line2Start(center.x + lineLength * cos(lineAngle2), center.y + lineLength * sin(lineAngle2));
    ImVec2 line2End(center.x - lineLength * cos(lineAngle2), center.y - lineLength * sin(lineAngle2));
    draw_list->AddLine(line1Start, line1End, mainLineColor, 2.0f);
    draw_list->AddLine(line2Start, line2End, mainLineColor, 2.0f);

    // 绘制扫描线
    float newRotationAngle = rotationAngle + 0.02f;
    float rotationAngle2 = rotationAngle;
    ImVec2 outerCirclePos = ImVec2(center.x + radius * cos(newRotationAngle), center.y + radius * sin(newRotationAngle));
    draw_list->AddLine(center, outerCirclePos, scanLineColor, 3.0f);

    // 添加动态扫描效果（渐变）
    for (float alpha = 1.0f; alpha >= 0.0f; alpha -= 0.01f) {
        ImColor dynamicColor = ImColor(0, 255, 0, static_cast<int>(255 * alpha));
        outerCirclePos = ImVec2(center.x + radius * cos(rotationAngle2), center.y + radius * sin(rotationAngle2));
        draw_list->AddLine(center, outerCirclePos, dynamicColor, 2.0f);
        rotationAngle2 -= 0.02f;
    }

    // 更新旋转角度
    rotationAngle = newRotationAngle;
}

void 绘图::初始化坐标(D4DVector &屏幕坐标, 骨骼数据 &骨骼) {
    left = 骨骼.Head.X - 屏幕坐标.Z / 2;
    right = 骨骼.Head.X + 屏幕坐标.Z / 2;
    top = 骨骼.Pelvis.Y - ((骨骼.Head.X != 0) ? (骨骼.Pelvis.Y - 骨骼.Head.Y) : (骨骼.Pelvis.Y - 骨骼.Chest.Y)) - 屏幕坐标.Z / 5;
    bottom = (骨骼.Left_Ankle.Y < 骨骼.Right_Ankle.Y) ? (骨骼.Right_Ankle.Y + 屏幕坐标.Z / 10) : (骨骼.Left_Ankle.Y + 屏幕坐标.Z / 10);
    MIDDLE = 屏幕坐标.X + 屏幕坐标.Z / 2;
    BOTTOM = 屏幕坐标.Y + 屏幕坐标.Z;
    TOP = 屏幕坐标.Y - 屏幕坐标.Z;
    屏幕坐标.X += 屏幕坐标.Z / 2; // 身位矫正，向右挪移半个身位
  //  骨骼头 = 骨骼.Head.X;
}

void 绘图::绘制方框(bool isboot) {
  ImGui::GetForegroundDrawList()->AddRect({ left, top }, { right, bottom }, ImColor(static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].方框颜色[0] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].方框颜色[1] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].方框颜色[2] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].方框颜色[3] * 255 + 0.5)), 0, 0, 绘制.按钮.方框粗细);
}



void 绘图::绘制人数(int 人机, int 真人) {
    ImDrawList* draw_list = ImGui::GetForegroundDrawList();
    // 计算总人数
    int 总人数 = 人机 + 真人;
    // 定义文本内容和颜色
    std::string 文本内容;
    ImColor 文本颜色 = ImColor(255, 255, 255, 255); // 不透明的白色
    ImColor 背景颜色 = ImColor(0, 0, 0, 150); // 半透明黑色
    if (总人数 == 0) {
        文本内容 = "安全";
    }
    else {
        文本内容 = "" + std::to_string(总人数);
    }
    // 计算文本大小
    auto textSize = ImGui::CalcTextSize(文本内容.c_str(), NULL, 250); // 进一步增大字体大小
    // 定义文本位置（居中并向上调整）
    float 文本X = PX - (textSize.x / 2);
    float 文本Y = (PY / 2) - 280; // 将Y坐标向上调整50像素
    // 定义圆形背景的位置和大小
    float 圆形半径 = textSize.y / 2 + 40; // 根据文本大小调整圆形半径
    ImVec2 圆形中心(文本X + textSize.x / 2, 文本Y + textSize.y / 2);
    // 绘制圆形背景
    draw_list->AddCircleFilled(圆形中心, 圆形半径, 背景颜色, 62);
    // 绘制文本
    draw_list->AddText(ImVec2(文本X, 文本Y), 文本颜色, 文本内容.c_str());
}

void 绘图::绘制距离(int 距离, int 队伍){  
  char DisData[24];
  sprintf(DisData,"[%dM]",(int)距离);
  AddTextBold(ImGui::GetBackgroundDrawList(), 21, MIDDLE + 48,top - 38,ImColor(255,255,0,255), ImColor(0,0,0,255),DisData);
  
  }


void 绘图::绘制射线(骨骼数据 &骨骼){
  ImGui::GetForegroundDrawList()->AddLine({ PX, 0 }, {骨骼.Head.X, top - 65}, ImColor(static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].射线颜色[0] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].射线颜色[1] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].射线颜色[2] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].射线颜色[3] * 255 + 0.5)), 绘制.按钮.射线粗细); // 使用白色，并增加线宽
}

void 绘图::绘制名字(string 名字, bool isboot, float 计时, bool 是否掐雷, char* 类名, int 阵营, int Bonecount){
       ImGui::GetBackgroundDrawList()->AddRectFilled({MIDDLE - 60, top - 42}, {MIDDLE + 100, top - 15},ImColor(0,0,0,140), 4, 0);

  //string a = isboot ? "isBot" : 名字;
  string a = (isboot && 阵营 != -1) ? "isBot" : 名字;
  //a+= "[骨骼数"+ to_string(Bonecount) +"]";
  if (strstr(类名, "BOSS") != 0) {
    a += "[BOSS]";
  }
  if(是否掐雷) {
    //a += " 计时-[" + to_string((float)计时) + "]";
    char buffer[50];
    float 计时保留一位小数点 = static_cast<float>(计时);
    std::sprintf(buffer, "%.1f", 计时保留一位小数点);
    a += " 计时-[" + std::string(buffer) + "]";
  }
  AddTextBold(ImGui::GetBackgroundDrawList(), 20, MIDDLE - 55,top - 38,ImColor(255,255,255,255), ImColor(0,0,0,255),a.c_str());
  ImGui::GetBackgroundDrawList()->AddRectFilled({MIDDLE - 90, top - 42}, {MIDDLE - 60, top - 15},ImColor(128, 0, 128, 255), 4, 0);

  std::string s;
    s += std::to_string((int)阵营);
    auto textSize1 = ImGui::CalcTextSize(s.c_str(), 0, 30);
    AddTextBold(ImGui::GetBackgroundDrawList(),22  , MIDDLE - 70 - (textSize1.x / 2), top - 38, ImColor(255,255,255,255),ImColor(0,0,0,255), s.c_str());
}

void 绘图::绘制血量(float 最大血量, float 当前血量,骨骼数据 &骨骼) {
  float 血量 = 当前血量/最大血量*100;
  
  if(绘制.按钮.血条样式==0)
  {
      ImGui::GetBackgroundDrawList()->AddRectFilled({MIDDLE - 90, top - 16}, {MIDDLE - 102 + (2 *血量), top - 11}, ImColor(255, 255, 0, 200), 1, 0);
                        
  }
  if(绘制.按钮.血条样式==1)
  {
          std::string duo;
                            duo += std::to_string((int)血量);
                            duo += " %";
                            auto textSize = ImGui::CalcTextSize(duo.c_str(), 0, 25);
                            AddTextBold(ImGui::GetBackgroundDrawList(),25,骨骼.Head.X - ((textSize.x / 2) / 2), top - 68, ImColor(255, 255, 0, 200),ImColor(0,0,0,255), duo.c_str());
                   }
  if(绘制.按钮.血条样式==2)
  {
      
      
      
          std::string duo;
                            duo += std::to_string((int)血量);
                            auto textSize = ImGui::CalcTextSize(duo.c_str(), 0, 15);
                            float aa =血量*3.6;
                            ImGui::GetBackgroundDrawList()->AddCircleArc({骨骼.Head.X, top - 130},20, {0, aa}, ImColor(0, 255, 0, 200),  0, 5);
                            ImGui::GetBackgroundDrawList()->AddText(NULL,20,{骨骼.Head.X - ((textSize.x / 2) / 2), top - 140}, ImColor(255, 255, 255, 200), duo.c_str());
  
  
  
  }

}
void 绘图::绘制手持(int 手持, int 状态){
手持 = heldconversion(手持);
if (手持图片.find(手持) != 手持图片.end()) {
    ImGui::GetForegroundDrawList()->AddImage(手持图片[手持].textureId, ImVec2(MIDDLE - 75*0.7f, top - 135*0.7f), ImVec2(MIDDLE + 75*0.7f, top - 100*0.7f), ImVec2(0, 0), ImVec2(1, 1), ImColor(ImVec4(1.0f, 1.0f, 1.0f, 1.0f)));
	}
	string a = GetHol(状态);
	auto Size = ImGui::CalcTextSize(a.c_str(), 0, 26);
	绘制加粗文本(26,MIDDLE - (Size.x / 2),bottom, 颜色.白色,颜色.白色, a.c_str());
}

void 绘图::绘制骨骼(骨骼数据 &骨骼,D4DVector &屏幕坐标, bool LineOfSightTo){
  //ImColor 骨骼color = ImColor(static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].骨骼颜色[0] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].骨骼颜色[1] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].骨骼颜色[2] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].骨骼颜色[3] * 255 + 0.5));
  
  ImColor 骨骼color;
  if (LineOfSightTo) {
    骨骼color = ImColor(static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].骨骼颜色[0] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].骨骼颜色[1] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].骨骼颜色[2] * 255 + 0.5),static_cast<int>(绘制.Colorset[(int)绘制.对象信息.敌人信息.isboot].骨骼颜色[3] * 255 + 0.5));
  }else {
    骨骼color = ImColor(0,255,0,100);
  }
  
  ImGui::GetBackgroundDrawList()->AddCircle(ImVec2(骨骼.Head.X, 骨骼.Head.Y), 屏幕坐标.W/13, 骨骼color, 0, 绘制.按钮.骨骼粗细);
  if (sqrt(pow(骨骼.Chest.X - 骨骼.Pelvis.X, 2) + pow(骨骼.Chest.Y - 骨骼.Pelvis.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Chest.X, 骨骼.Chest.Y}, {骨骼.Pelvis.X, 骨骼.Pelvis.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Chest.X - 骨骼.Left_Shoulder.X, 2) + pow(骨骼.Chest.Y - 骨骼.Left_Shoulder.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Chest.X, 骨骼.Chest.Y}, {骨骼.Left_Shoulder.X,骨骼.Left_Shoulder.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Left_Shoulder.X - 骨骼.Left_Elbow.X, 2) + pow(骨骼.Left_Shoulder.Y - 骨骼.Left_Elbow.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Left_Shoulder.X, 骨骼.Left_Shoulder.Y}, {骨骼.Left_Elbow.X,骨骼.Left_Elbow.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Left_Elbow.X - 骨骼.Left_Wrist.X, 2) + pow(骨骼.Left_Elbow.Y - 骨骼.Left_Wrist.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Left_Elbow.X, 骨骼.Left_Elbow.Y}, {骨骼.Left_Wrist.X,骨骼.Left_Wrist.Y},骨骼color , 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Chest.X - 骨骼.Right_Shoulder.X, 2) + pow(骨骼.Chest.Y - 骨骼.Right_Shoulder.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Chest.X, 骨骼.Chest.Y}, {骨骼.Right_Shoulder.X,骨骼.Right_Shoulder.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Right_Shoulder.X - 骨骼.Right_Elbow.X, 2) + pow(骨骼.Right_Shoulder.Y - 骨骼.Right_Elbow.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Right_Shoulder.X, 骨骼.Right_Shoulder.Y},{骨骼.Right_Elbow.X, 骨骼.Right_Elbow.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Right_Elbow.X - 骨骼.Right_Wrist.X, 2) + pow(骨骼.Right_Elbow.Y - 骨骼.Right_Wrist.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Right_Elbow.X, 骨骼.Right_Elbow.Y}, {骨骼.Right_Wrist.X,骨骼.Right_Wrist.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Pelvis.X - 骨骼.Left_Thigh.X, 2) + pow(骨骼.Pelvis.Y - 骨骼.Left_Thigh.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Pelvis.X, 骨骼.Pelvis.Y}, {骨骼.Left_Thigh.X, 骨骼.Left_Thigh.Y},骨骼color, 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Left_Thigh.X - 骨骼.Left_Knee.X, 2) + pow(骨骼.Left_Thigh.Y - 骨骼.Left_Knee.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Left_Thigh.X, 骨骼.Left_Thigh.Y}, {骨骼.Left_Knee.X,骨骼.Left_Knee.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Left_Knee.X - 骨骼.Left_Ankle.X, 2) + pow(骨骼.Left_Knee.Y - 骨骼.Left_Ankle.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Left_Knee.X, 骨骼.Left_Knee.Y}, {骨骼.Left_Ankle.X,骨骼.Left_Ankle.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Pelvis.X - 骨骼.Right_Thigh.X, 2) + pow(骨骼.Pelvis.Y - 骨骼.Right_Thigh.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Pelvis.X, 骨骼.Pelvis.Y}, {骨骼.Right_Thigh.X,骨骼.Right_Thigh.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }if (sqrt(pow(骨骼.Right_Thigh.X - 骨骼.Right_Knee.X, 2) + pow(骨骼.Right_Thigh.Y - 骨骼.Right_Knee.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Right_Thigh.X, 骨骼.Right_Thigh.Y}, {骨骼.Right_Knee.X,骨骼.Right_Knee.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }
  if (sqrt(pow(骨骼.Right_Knee.X - 骨骼.Right_Ankle.X, 2) + pow(骨骼.Right_Knee.Y - 骨骼.Right_Ankle.Y, 2)) < 100){
    ImGui::GetForegroundDrawList()->AddLine({骨骼.Right_Knee.X, 骨骼.Right_Knee.Y}, {骨骼.Right_Ankle.X,骨骼.Right_Ankle.Y}, 骨骼color, 绘制.按钮.骨骼粗细);
  }
}

void 绘图::绘制自瞄触摸范围(float 触摸范围,float 触摸范围X,float 触摸范围Y) {
  auto textSize = ImGui::CalcTextSize("触摸区域，勿放控件", 0, 30);
  ImGui::GetForegroundDrawList()->AddRectFilled({触摸范围X - 触摸范围/2, PY*2 - 触摸范围Y + 触摸范围/2}, {触摸范围X + 触摸范围/2, PY*2 - 触摸范围Y - 触摸范围/2},ImColor(255,0,0,120));
  ImGui::GetForegroundDrawList()->AddText(NULL,30,{触摸范围X - (textSize.x / 2),PY*2 - 触摸范围Y},ImColor(255,255,255),"触摸区域，勿放控件");
}


void 绘图::绘制字体描边(float size,int x, int y, ImVec4 color, const char* str){
    ImGui::GetBackgroundDrawList()->AddText(nullptr, size,ImVec2(x + 1, y), ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 1.0f)), str);
    ImGui::GetBackgroundDrawList()->AddText(nullptr, size,ImVec2(x - 0.1, y), ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 1.0f)), str);
    ImGui::GetBackgroundDrawList()->AddText(nullptr, size,ImVec2(x, y + 1), ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 1.0f)), str);
    ImGui::GetBackgroundDrawList()->AddText(nullptr, size,ImVec2(x, y - 1), ImGui::ColorConvertFloat4ToU32(ImVec4(0.0f, 0.0f, 0.0f, 1.0f)), str);
    ImGui::GetBackgroundDrawList()->AddText(nullptr, size,ImVec2(x, y), ImGui::ColorConvertFloat4ToU32(color), str);
}

void 绘图::绘制加粗文本(float size, float x, float y, ImColor color, ImColor color1, const char* str) {
    ImGui::GetBackgroundDrawList()->AddText(nullptr, size, ImVec2(x-0.5, y-0.5), color1, str);
    ImGui::GetBackgroundDrawList()->AddText(nullptr, size, ImVec2(x+0.5, y+0.5), color1, str);
    ImGui::GetBackgroundDrawList()->AddText(nullptr, size, ImVec2(x, y), color, str);
}